<template>
	<view class="container">
		<view class="item" v-for="(item,index) in cloneVoiceList" :key="index">
			<view class="left">
				声音编号: <text style="font-size: 30rpx; font-weight: bold;">{{item.voiceId}}</text>
			</view>
			<view class="right">
				<text style="display: inline-block; width: 200rpx; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">{{item.message == null?'合成失败':item.message}}</text>
				<view style="margin-left: 15rpx;line-height: 60rpx; color: #d4237a; text-align: center; border-radius: 10rpx; height: 60rpx;width: 80rpx;border: 1rpx solid #d4237a;" @click="deleteClone(item.jobId)">
					删除
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import Http from '../../utils/http';
	const http =new Http()
	export default {
		data() {
			return {
				cloneVoiceList:[]
			}
		},
		onLoad() {
			this.getInfo();
		},
		methods: {
			getInfo(){
				http.get('v1/clone/voiceList').then(res=>{
					this.cloneVoiceList = res.data.data.body.data.customizedVoiceJobList;
				})
			},
			deleteClone(id){
				http.get('v1/clone/delete/'+id).then(res=>{
					if(res.data.code == 200){
						this.getInfo();
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: rgb(238, 234, 249);
		padding: 20rpx;
	}
	.container{
		min-height: 100vh;
		padding: 20rpx;
		background-color: rgb(238, 234, 249);
		.item{
			padding: 10rpx;
			height: 80rpx;
			border-bottom: 1rpx solid darkgray;
			display: flex;
			align-items: center;
			justify-content: space-between;
			background-color: white;
			.right{
				display: flex;
				align-items: center;
			}
		}
	}
</style>
